package com.mccrea.pattern.mediator;

/**
 * @Classname Client
 * @Description 中介者模式测试
 * @Date 2021/5/24 0024 11:33
 * @Created by Mccrea_Gao
 */
public class Client {
    public static void main(String[] args) {
        // 中介者
        Mediator mediator = new ConcreteMediator();
        // 具体同事类1
        Colleague colleague1 = new ConcreteColleague1();
        // 具体同事类2
        Colleague colleague2 = new ConcreteColleague2();
        // 具体同事类3
        Colleague colleague3 = new ConcreteColleague3();
        // 同事类1和2注册到中介者中
        mediator.register(colleague1);
        mediator.register(colleague2);
        mediator.register(colleague3);
        colleague1.send();
        System.out.println("同事类一发送完成");
        colleague2.send();
        System.out.println("同事类二发送完成");
        colleague3.send();
        System.out.println("同事类三发送完成");
    }
}
